package com.fight.strive.sys.modules.rbac.dto;

import com.fight.strive.sys.modules.rbac.entity.RbacDepartmentEntity;
import com.fight.strive.sys.modules.rbac.entity.RbacUserDepartmentEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@NoArgsConstructor
public class RbacUserDepartmentDto extends RbacUserDepartmentEntity {

    public RbacUserDepartmentDto(RbacUserDepartmentEntity entity) {
        this.setUserId(entity.getUserId());
        this.setDepartmentId(entity.getDepartmentId());
        this.setPosition(entity.getPosition());
        this.setFlag(entity.getFlag());
    }

    public RbacUserDepartmentDto(RbacUserDepartmentEntity userDepartment,
                                 RbacDepartmentEntity department) {
        this(userDepartment);
        this.departmentCode = department.getCode();
        this.departmentName = department.getName();
    }

    /**
     * 部门代码
     */
    private String departmentCode;

    /**
     * 部门名称
     */
    private String departmentName;
}
